<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="ligerForm">
				<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
						<span class="title">档案基础信息新增</span>
					</div>
					<div class="fieldBox col_33">
						<div class="label">权证名称</div>
						<div class="field">
							<input id="warrantName"  name="warrantName"  value=""  type="text"   class="ui-textbox">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">权证类别</div>
						<div class="field">
							<select id="warrantType"  name="warrantType"  ligerui="width: 160">
									<option value="">请选择</option>
									<c:forEach items="${warrantTypeList}" var="item">
										<option value="${item.key}">${item.value}</option>
									</c:forEach>
								</select>
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">权证级别</div>
						<div class="field">
							<select id="warrantGrade"  name="warrantGrade"  ligerui="width: 160">
									<option value="">请选择</option>
									<c:forEach items="${warrantGradeList}" var="item">
										<option value="${item.key}">${item.value}</option>
									</c:forEach>
								</select>
							<span class="requiredSymbol">*</span>
						</div>
					</div>
				
				</div>
				
				<div class="btnsBox">
					<span id="addBtn" class="sq-button sq-button-round" onclick="add()">保存</span>
					<!-- <span id="closeBtn" class="sq-button sq-button-round" onclick="Remove_navTab()">关闭</span> -->
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			$("#ligerForm").ligerForm({
				validate: true
			});
	    });
	
		//保存
		function add(){
			var ligerForm = liger.get("ligerForm");
			if (!ligerForm.valid()) {
				$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; 
			}
			
			
			var warrantName = $("#warrantName").val();
			if(warrantName == ""){
				$.ligerDialog.SQalert({content: "请填写权证名称",SQ_type: "warning"});
				return false;
			}
			
			var _warrantType = liger.get("warrantType");
			var warrantType = _warrantType.getValue();
			if(!warrantType){
				$.ligerDialog.SQalert({content: "请选择权证类别！",SQ_type: "warning"});
				return false;
			}
			
			var _warrantGrade = liger.get("warrantGrade");
			var warrantGrade = _warrantGrade.getValue();
			if(!warrantGrade){
				$.ligerDialog.SQalert({content: "请选择权证级别！",SQ_type: "warning"});
				return false;
			}
			
			var data = ligerForm.getData();//获取表单数据
			//data["warrantType"] = warrantType;
			
		
			var wait_dialog = null;
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: '<%=path%>/archive/arcBscInfo/add.do',
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						if(null != msg.data){
							$("#pId").val(msg.data);
						}
						
					}else{
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
	</script>
</body>
</html>